/**
 * Copyright：2020，TLF工作室。
 */
package com.cqeec.netdisc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.cqeec.netdisc.interceptor.UserAuthenticationInterceptor;

/**
 * SpringMVC拦截器配置。
 * 
 * @author 唐礼飞
 * 
 * @date 2020-10-30 10:04:33
 *
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		InterceptorRegistration registration = registry.addInterceptor(new UserAuthenticationInterceptor());
		registration.addPathPatterns("/**");
		registration.excludePathPatterns("/")
			.excludePathPatterns("/login")
			.excludePathPatterns("/user/login")
			.excludePathPatterns("/user/exit")
			.excludePathPatterns("/captcha")
			.excludePathPatterns("/user/register")
			.excludePathPatterns("/user/register/save")
			.excludePathPatterns("/static/**");
		WebMvcConfigurer.super.addInterceptors(registry);
	}

}
